package cn.itrip.biz.controller;

import cn.itrip.beans.dto.Dto;
import cn.itrip.beans.pojo.ItripHotelRoom;
import cn.itrip.beans.vo.HotelRoomParam;
import cn.itrip.beans.vo.ItripHotelRoomVO;
import cn.itrip.biz.service.HotelRoomService;
import cn.itrip.utlis.DtoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description :
 * Created by Li on 2020-12-28 09:17:22
 */
@RestController
@RequestMapping("/api/hotelroom")
public class HotelRoomController {
    @Autowired
    private HotelRoomService hotelRoomService;

    @PostMapping("/queryhotelroombyhotel")
    public Dto queryhotelroombyhotel(@RequestBody HotelRoomParam hotelRoomParam){
        List<List<ItripHotelRoomVO>> hotelRoomVOList = null;
        List<ItripHotelRoomVO> originalRoomList = hotelRoomService.queryhotelroombyhotel(hotelRoomParam);
        hotelRoomVOList = new ArrayList();
        for (ItripHotelRoomVO roomVO:originalRoomList) {
            List<ItripHotelRoomVO> tempList = new ArrayList<ItripHotelRoomVO>();
            tempList.add(roomVO);
            hotelRoomVOList.add(tempList);
        }
        return DtoUtil.returnSuccess("获取成功",hotelRoomVOList);
    }
}
